//  this library.
import 'package:hktk_app/model/industry/category_model.dart';

/// 考试相关信息model
class ExamModel {
  String? createdTime;
  String? modifyTime;
  String? createdBy;
  String? modifyBy;
  String? id;
  String? name;
  String? serverName;
  String? industryId;
  int? sort;

  // 图标
  String? icon;
  int? attribute;
  String? industryName;
  int? categoryCount;
  List<CategoryModel>? categorys;
  int? authFlag;

  // 是否最新
  bool? isNew;
  String? keyword;
  String? code;

  // 是否是热门考试
  bool? isHot;

  // 是否是推荐考试
  bool? isRecommend;

  ExamModel({
    this.createdTime,
    this.modifyTime,
    this.createdBy,
    this.modifyBy,
    this.id,
    this.name,
    this.serverName,
    this.industryId,
    this.sort,
    this.icon,
    this.attribute,
    this.industryName,
    this.categoryCount,
    this.categorys,
    this.authFlag,
    this.isNew,
    this.keyword,
    this.code,
    this.isHot,
    this.isRecommend,
  });

  ExamModel.fromJson(Map<String, dynamic> json) {
    createdTime = json['createdTime'];
    modifyTime = json['modifyTime'];
    createdBy = json['createdBy'];
    modifyBy = json['modifyBy'];
    id = json['id'];
    name = json['name'];
    serverName = json['serverName'];
    industryId = json['industryId'];
    sort = json['sort'];
    icon = json['icon'];
    attribute = json['attribute'];
    industryName = json['industryName'];
    categoryCount = json['categoryCount'];
    if (json['categorys'] != null) {
      categorys = <CategoryModel>[];
      json['categorys'].forEach((v) {
        categorys!.add(CategoryModel.fromJson(v));
      });
    }
    authFlag = json['authFlag'];
    keyword = json['keyword'];
    code = json['code'];
    isHot = json['isHot'];
    isRecommend = json['isRecommend'];
    isNew = json['isNew'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['createdTime'] = createdTime;
    data['modifyTime'] = modifyTime;
    data['createdBy'] = createdBy;
    data['modifyBy'] = modifyBy;
    data['id'] = id;
    data['name'] = name;
    data['serverName'] = serverName;
    data['industryId'] = industryId;
    data['sort'] = sort;
    data['icon'] = icon;
    data['attribute'] = attribute;
    data['industryName'] = industryName;
    data['categoryCount'] = categoryCount;
    if (categorys != null) {
      data['categorys'] = categorys!.map((v) => v.toJson()).toList();
    }
    data['authFlag'] = authFlag;
    data['keyword'] = keyword;
    data['code'] = code;
    data['isHot'] = isHot;
    data['isRecommend'] = isRecommend;
    data['isNew'] = isNew;
    return data;
  }
}
